<!DOCTYPE HTML>
<html lang="en" >
    <!-- Start book Python爬虫课程讲义 -->
    <head>
        <!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>机器视觉与Tesseract介绍 | Python爬虫课程讲义</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="BigCat">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-tbfed-pagefooter/footer.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../file/part03/3.7.html" />
    
    
    <link rel="prev" href="../../file/part03/3.5.html" />
    

        <!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
        
    <div class="book"
        data-level="3.6"
        data-chapter-title="机器视觉与Tesseract介绍"
        data-filepath="file/part03/3.6.md"
        data-basepath="../.."
        data-revision="Thu Feb 09 2017 09:48:59 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        传智播客Python学院爬虫课程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="file/part01/1.html">
            
                
                    <a href="../../file/part01/1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        爬虫原理与数据抓取
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="file/part01/1.1.html">
            
                
                    <a href="../../file/part01/1.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        (了解)通用爬虫和聚焦爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="file/part01/1.2.html">
            
                
                    <a href="../../file/part01/1.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        (复习)HTTP/HTTPS的请求与响应
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="file/part01/1.3.html">
            
                
                    <a href="../../file/part01/1.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        HTTP/HTTPS抓包工具-Fiddler
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="file/part01/1.4.html">
            
                
                    <a href="../../file/part01/1.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        urllib2模块的基本使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="file/part01/1.5.html">
            
                
                    <a href="../../file/part01/1.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        urllib2：GET请求和POST请求
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="file/part01/1.6.html">
            
                
                    <a href="../../file/part01/1.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        urllib2：Handler处理器和自定义Opener
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="file/part01/1.7.html">
            
                
                    <a href="../../file/part01/1.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        urllib2：URLError与HTTPError
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="file/part01/1.8.html">
            
                
                    <a href="../../file/part01/1.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        Requests模块
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="file/part02/2.html">
            
                
                    <a href="../../file/part02/2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        非结构化数据与结构化数据提取
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="file/part02/2.1.html">
            
                
                    <a href="../../file/part02/2.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        正则表达式re模块
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="file/part02/2.2.html">
            
                
                    <a href="../../file/part02/2.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        案例：使用正则表达式的爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="file/part02/2.3.html">
            
                
                    <a href="../../file/part02/2.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        XPath与lxml类库
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="file/part02/2.4.html">
            
                
                    <a href="../../file/part02/2.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        案例：使用XPath的爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="file/part02/2.5.html">
            
                
                    <a href="../../file/part02/2.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        BeautifulSoup4 解析器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="file/part02/2.6.html">
            
                
                    <a href="../../file/part02/2.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        案例：使用bs4的爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="file/part02/2.7.html">
            
                
                    <a href="../../file/part02/2.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        JSON模块与JsonPath
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="file/part02/2.8.html">
            
                
                    <a href="../../file/part02/2.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        糗事百科案例
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="file/part02/2.9.html">
            
                
                    <a href="../../file/part02/2.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        多线程爬虫案例
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="file/part03/3.html">
            
                
                    <a href="../../file/part03/3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        动态HTML处理和机器图像识别
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="file/part03/3.1.html">
            
                
                    <a href="../../file/part03/3.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        动态HTML介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="file/part03/3.2.html">
            
                
                    <a href="../../file/part03/3.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        Selenium与PhantomJS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="file/part03/3.3.html">
            
                
                    <a href="../../file/part03/3.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        案例一：网站模拟登录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="file/part03/3.4.html">
            
                
                    <a href="../../file/part03/3.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        案例二：动态页面模拟点击
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="file/part03/3.5.html">
            
                
                    <a href="../../file/part03/3.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        案例三：执行JavaScript语句
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.6" data-path="file/part03/3.6.html">
            
                
                    <a href="../../file/part03/3.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        机器视觉与Tesseract介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="file/part03/3.7.html">
            
                
                    <a href="../../file/part03/3.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        处理一些格式规范的文字
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="file/part03/3.8.html">
            
                
                    <a href="../../file/part03/3.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        案例：尝试对验证码进行机器识别处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="file/part03/3.9.html">
            
                
                    <a href="../../file/part03/3.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        机器学习：训练Tesseract
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="file/part04/4.html">
            
                
                    <a href="../../file/part04/4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        Scrapy框架
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="file/part04/4.1.html">
            
                
                    <a href="../../file/part04/4.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        配置安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="file/part04/4.2.html">
            
                
                    <a href="../../file/part04/4.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        入门案例
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="file/part04/4.3.html">
            
                
                    <a href="../../file/part04/4.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        Scrapy Shell
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="file/part04/4.4.html">
            
                
                    <a href="../../file/part04/4.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        Item Pipeline
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="file/part04/4.5.html">
            
                
                    <a href="../../file/part04/4.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        Spiders
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="file/part04/4.6.html">
            
                
                    <a href="../../file/part04/4.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        CrawlSpiders
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="file/part04/4.7.html">
            
                
                    <a href="../../file/part04/4.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        Request/Response
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="file/part04/4.8.html">
            
                
                    <a href="../../file/part04/4.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        Downloader Middlewares
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="file/part04/4.9.html">
            
                
                    <a href="../../file/part04/4.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.</b>
                        
                        Settings
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="file/part05/5.html">
            
                
                    <a href="../../file/part05/5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Scrapy实战项目
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="file/part05/5.1.html">
            
                
                    <a href="../../file/part05/5.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        (案例一)手机App抓包爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="file/part05/5.2.html">
            
                
                    <a href="../../file/part05/5.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        (案例二)阳光热线问政平台爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="file/part05/5.3.html">
            
                
                    <a href="../../file/part05/5.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        (案例三)新浪网分类资讯爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="file/part05/5.4.html">
            
                
                    <a href="../../file/part05/5.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        (案例四)图片下载器爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="file/part05/5.5.html">
            
                
                    <a href="../../file/part05/5.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        (案例五)将数据保存在MongoDB中
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="file/part05/5.6.html">
            
                
                    <a href="../../file/part05/5.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        (案例六)三种scrapy模拟登陆策略
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="file/part05/5.7.html">
            
                
                    <a href="../../file/part05/5.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        附：通过Fiddler进行手机抓包方法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="file/part06/6.html">
            
                
                    <a href="../../file/part06/6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        scrapy-redis分布式组件
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="file/part06/6.1.html">
            
                
                    <a href="../../file/part06/6.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        源码分析参考：Connection
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="file/part06/6.2.html">
            
                
                    <a href="../../file/part06/6.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        源码分析参考：Dupefilter
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="file/part06/6.3.html">
            
                
                    <a href="../../file/part06/6.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        源码分析参考：Picklecompat
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="file/part06/6.4.html">
            
                
                    <a href="../../file/part06/6.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        源码分析参考：Pipelines
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="file/part06/6.5.html">
            
                
                    <a href="../../file/part06/6.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.</b>
                        
                        源码分析参考：Queue
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="file/part06/6.6.html">
            
                
                    <a href="../../file/part06/6.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.</b>
                        
                        源码分析参考：Scheduler
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="file/part06/6.7.html">
            
                
                    <a href="../../file/part06/6.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.</b>
                        
                        源码分析参考：Spider
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="file/part07/7.html">
            
                
                    <a href="../../file/part07/7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        scrapy-redis实战
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="file/part07/7.1.html">
            
                
                    <a href="../../file/part07/7.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        源码自带项目说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="file/part07/7.2.html">
            
                
                    <a href="../../file/part07/7.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        有缘网分布式爬虫项目1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="file/part07/7.3.html">
            
                
                    <a href="../../file/part07/7.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        有缘网分布式爬虫项目2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="file/part07/7.4.html">
            
                
                    <a href="../../file/part07/7.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.4.</b>
                        
                        处理Redis里的数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="file/part07/7.5.html">
            
                
                    <a href="../../file/part07/7.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.5.</b>
                        
                        尝试改写新浪网分类资讯爬虫1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="file/part07/7.6.html">
            
                
                    <a href="../../file/part07/7.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.6.</b>
                        
                        尝试改写新浪网分类资讯爬虫2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.7" data-path="file/part07/7.7.html">
            
                
                    <a href="../../file/part07/7.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.7.</b>
                        
                        IT桔子分布式项目1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.8" data-path="file/part07/7.8.html">
            
                
                    <a href="../../file/part07/7.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.8.</b>
                        
                        IT桔子分布式项目2
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="file/duanzi/duanzi.html">
            
                
                    <a href="../../file/duanzi/duanzi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        课余段子
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >Python爬虫课程讲义</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h2 id="&#x673A;&#x5668;&#x89C6;&#x89C9;">&#x673A;&#x5668;&#x89C6;&#x89C9;</h2>
<p>&#x4ECE; Google &#x7684;&#x65E0;&#x4EBA;&#x9A7E;&#x9A76;&#x6C7D;&#x8F66;&#x5230;&#x53EF;&#x4EE5;&#x8BC6;&#x522B;&#x5047;&#x949E;&#x7684;&#x81EA;&#x52A8;&#x552E;&#x5356;&#x673A;&#xFF0C;&#x673A;&#x5668;&#x89C6;&#x89C9;&#x4E00;&#x76F4;&#x90FD;&#x662F;&#x4E00;&#x4E2A;&#x5E94;&#x7528;&#x5E7F; &#x6CDB;&#x4E14;&#x5177;&#x6709;&#x6DF1;&#x8FDC;&#x7684;&#x5F71;&#x54CD;&#x548C;&#x96C4;&#x4F1F;&#x7684;&#x613F;&#x666F;&#x7684;&#x9886;&#x57DF;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x5C06;&#x91CD;&#x70B9;&#x4ECB;&#x7ECD;&#x673A;&#x5668;&#x89C6;&#x89C9;&#x7684;&#x4E00;&#x4E2A;&#x5206;&#x652F;&#xFF1A;&#x6587;&#x5B57;&#x8BC6;&#x522B;&#xFF0C;&#x4ECB;&#x7ECD;&#x5982;&#x4F55;&#x7528;&#x4E00;&#x4E9B; Python&#x5E93;&#x6765;&#x8BC6;&#x522B;&#x548C;&#x4F7F;&#x7528;&#x5728;&#x7EBF;&#x56FE;&#x7247;&#x4E2D;&#x7684;&#x6587;&#x5B57;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5F88;&#x8F7B;&#x677E;&#x7684;&#x9605;&#x8BFB;&#x56FE;&#x7247;&#x91CC;&#x7684;&#x6587;&#x5B57;&#xFF0C;&#x4F46;&#x662F;&#x673A;&#x5668;&#x9605;&#x8BFB;&#x8FD9;&#x4E9B;&#x56FE;&#x7247;&#x5C31;&#x4F1A;&#x975E;&#x5E38;&#x56F0;&#x96BE;&#xFF0C;&#x5229;&#x7528;&#x8FD9;&#x79CD;&#x4EBA;&#x7C7B;&#x7528;&#x6237;&#x53EF;&#x4EE5;&#x6B63;&#x5E38;&#x8BFB;&#x53D6;&#x4F46;&#x662F;&#x5927;&#x591A;&#x6570;&#x673A;&#x5668;&#x4EBA;&#x90FD;&#x6CA1;&#x6CD5;&#x8BFB;&#x53D6;&#x7684;&#x56FE;&#x7247;&#xFF0C;&#x9A8C;&#x8BC1;&#x7801; (CAPTCHA)&#x5C31;&#x51FA;&#x73B0;&#x4E86;&#x3002;&#x9A8C;&#x8BC1;&#x7801;&#x8BFB;&#x53D6;&#x7684;&#x96BE;&#x6613;&#x7A0B;&#x5EA6;&#x4E5F;&#x5927;&#x4E0D;&#x76F8;&#x540C;&#xFF0C;&#x6709;&#x4E9B;&#x9A8C;&#x8BC1;&#x7801;&#x6BD4;&#x5176;&#x4ED6;&#x7684;&#x66F4;&#x52A0;&#x96BE;&#x8BFB;&#x3002;</p>
<p>&#x5C06;&#x56FE;&#x50CF;&#x7FFB;&#x8BD1;&#x6210;&#x6587;&#x5B57;&#x4E00;&#x822C;&#x88AB;&#x79F0;&#x4E3A;&#x5149;&#x5B66;&#x6587;&#x5B57;&#x8BC6;&#x522B;(Optical Character Recognition, OCR)&#x3002;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;OCR&#x7684;&#x5E95;&#x5C42;&#x5E93;&#x5E76;&#x4E0D;&#x591A;,&#x76EE;&#x524D;&#x5F88;&#x591A;&#x5E93;&#x90FD;&#x662F;&#x4F7F;&#x7528;&#x5171;&#x540C;&#x7684;&#x51E0;&#x4E2A;&#x5E95;&#x5C42; OCR &#x5E93;,&#x6216;&#x8005;&#x662F;&#x5728;&#x4E0A;&#x9762; &#x8FDB;&#x884C;&#x5B9A;&#x5236;&#x3002;</p>
<h2 id="orc&#x5E93;&#x6982;&#x8FF0;">ORC&#x5E93;&#x6982;&#x8FF0;</h2>
<p> &#x5728;&#x8BFB;&#x53D6;&#x548C;&#x5904;&#x7406;&#x56FE;&#x50CF;&#x3001;&#x56FE;&#x50CF;&#x76F8;&#x5173;&#x7684;&#x673A;&#x5668;&#x5B66;&#x4E60;&#x4EE5;&#x53CA;&#x521B;&#x5EFA;&#x56FE;&#x50CF;&#x7B49;&#x4EFB;&#x52A1;&#x4E2D;&#xFF0C;Python &#x4E00;&#x76F4;&#x90FD;&#x662F;&#x975E;&#x5E38;&#x51FA;&#x8272;&#x7684;&#x8BED;&#x8A00;&#x3002;&#x867D;&#x7136;&#x6709;&#x5F88;&#x591A;&#x5E93;&#x53EF;&#x4EE5;&#x8FDB;&#x884C;&#x56FE;&#x50CF;&#x5904;&#x7406;&#xFF0C;&#x4F46;&#x5728;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x53EA;&#x91CD;&#x70B9;&#x4ECB;&#x7ECD;&#xFF1A;<a href="https://pypi.python.org/pypi/pytesseract" target="_blank">Tesseract</a></p>
<h3 id="tesseract">Tesseract</h3>
<p>Tesseract &#x662F;&#x4E00;&#x4E2A; OCR &#x5E93;,&#x76EE;&#x524D;&#x7531; Google &#x8D5E;&#x52A9;(Google &#x4E5F;&#x662F;&#x4E00;&#x5BB6;&#x4EE5; OCR &#x548C;&#x673A;&#x5668;&#x5B66;&#x4E60;&#x6280;&#x672F;&#x95FB;&#x540D;&#x4E8E;&#x4E16;&#x7684;&#x516C;&#x53F8;)&#x3002;Tesseract &#x662F;&#x76EE;&#x524D;&#x516C;&#x8BA4;&#x6700;&#x4F18;&#x79C0;&#x3001;&#x6700;&#x7CBE;&#x786E;&#x7684;&#x5F00;&#x6E90; OCR &#x7CFB;&#x7EDF;&#x3002; &#x9664;&#x4E86;&#x6781;&#x9AD8;&#x7684;&#x7CBE;&#x786E;&#x5EA6;,Tesseract &#x4E5F;&#x5177;&#x6709;&#x5F88;&#x9AD8;&#x7684;&#x7075;&#x6D3B;&#x6027;&#x3002;&#x5B83;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BAD;&#x7EC3;&#x8BC6;&#x522B;&#x51FA;&#x4EFB;&#x4F55;&#x5B57;&#x4F53;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x8BC6;&#x522B;&#x51FA;&#x4EFB;&#x4F55; Unicode &#x5B57;&#x7B26;&#x3002; </p>
<h2 id="&#x5B89;&#x88C5;tesseract">&#x5B89;&#x88C5;Tesseract</h2>
<h3 id="windows-&#x7CFB;&#x7EDF;">Windows &#x7CFB;&#x7EDF;</h3>
<p>&#x4E0B;&#x8F7D;&#x53EF;&#x6267;&#x884C;&#x5B89;&#x88C5;&#x6587;&#x4EF6;<a href="https://code.google.com/p/tesseract-ocr/downloads/list" target="_blank">https://code.google.com/p/tesseract-ocr/downloads/list</a>&#x5B89;&#x88C5;&#x3002;</p>
<h3 id="linux-&#x7CFB;&#x7EDF;">Linux &#x7CFB;&#x7EDF;</h3>
<p>&#x53EF;&#x4EE5;&#x901A;&#x8FC7; apt-get &#x5B89;&#x88C5;: <code>$sudo apt-get tesseract-ocr</code></p>
<h3 id="mac-os-x&#x7CFB;&#x7EDF;">Mac OS X&#x7CFB;&#x7EDF;</h3>
<p>&#x7528; Homebrew(<a href="http://brew.sh/)&#x7B49;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;&#x53EF;&#x4EE5;&#x5F88;&#x65B9;&#x4FBF;&#x5730;&#x5B89;&#x88C5;" target="_blank">http://brew.sh/)&#x7B49;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;&#x53EF;&#x4EE5;&#x5F88;&#x65B9;&#x4FBF;&#x5730;&#x5B89;&#x88C5;</a>
<code>brew install tesseract</code></p>
<h5 id="&#x8981;&#x4F7F;&#x7528;-tesseract-&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x6BD4;&#x5982;&#x540E;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x4E2D;&#x8BAD;&#x7EC3;&#x7A0B;&#x5E8F;&#x8BC6;&#x522B;&#x5B57;&#x6BCD;&#xFF0C;&#x8981;&#x5148;&#x5728;&#x7CFB;&#x7EDF;&#x4E2D;&#x8BBE;&#x7F6E;&#x4E00;-&#x4E2A;&#x65B0;&#x7684;&#x73AF;&#x5883;&#x53D8;&#x91CF;-tessdataprefix&#xFF0C;&#x8BA9;-tesseract-&#x77E5;&#x9053;&#x8BAD;&#x7EC3;&#x7684;&#x6570;&#x636E;&#x6587;&#x4EF6;&#x5B58;&#x50A8;&#x5728;&#x54EA;&#x91CC;&#xFF0C;&#x7136;&#x540E;&#x641E;&#x4E00;&#x4EFD;tessdata&#x6570;&#x636E;&#x6587;&#x4EF6;&#xFF0C;&#x653E;&#x5230;tesseract&#x76EE;&#x5F55;&#x4E0B;&#x3002;">&#x8981;&#x4F7F;&#x7528; Tesseract &#x7684;&#x529F;&#x80FD;&#xFF0C;&#x6BD4;&#x5982;&#x540E;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x4E2D;&#x8BAD;&#x7EC3;&#x7A0B;&#x5E8F;&#x8BC6;&#x522B;&#x5B57;&#x6BCD;&#xFF0C;&#x8981;&#x5148;&#x5728;&#x7CFB;&#x7EDF;&#x4E2D;&#x8BBE;&#x7F6E;&#x4E00; &#x4E2A;&#x65B0;&#x7684;&#x73AF;&#x5883;&#x53D8;&#x91CF; <code>$TESSDATA_PREFIX</code>&#xFF0C;&#x8BA9; Tesseract &#x77E5;&#x9053;&#x8BAD;&#x7EC3;&#x7684;&#x6570;&#x636E;&#x6587;&#x4EF6;&#x5B58;&#x50A8;&#x5728;&#x54EA;&#x91CC;&#xFF0C;&#x7136;&#x540E;&#x641E;&#x4E00;&#x4EFD;tessdata&#x6570;&#x636E;&#x6587;&#x4EF6;&#xFF0C;&#x653E;&#x5230;Tesseract&#x76EE;&#x5F55;&#x4E0B;&#x3002;</h5>
<ul>
<li><p>&#x5728;&#x5927;&#x591A;&#x6570; Linux &#x7CFB;&#x7EDF;&#x548C; Mac OS X &#x7CFB;&#x7EDF;&#x4E0A;,&#x4F60;&#x53EF;&#x4EE5;&#x8FD9;&#x4E48;&#x8BBE;&#x7F6E;: <code>$export TESSDATA_PREFIX=/usr/local/share/Tesseract</code></p>
</li>
<li><p>&#x5728; Windows &#x7CFB;&#x7EDF;&#x4E0A;&#x4E5F;&#x7C7B;&#x4F3C;,&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E0B;&#x9762;&#x8FD9;&#x884C;&#x547D;&#x4EE4;&#x8BBE;&#x7F6E;&#x73AF;&#x5883;&#x53D8;&#x91CF;: <code>#setx TESSDATA_PREFIX C:\Program Files\Tesseract OCR\Tesseract</code></p>
</li>
</ul>
<h2 id="&#x5B89;&#x88C5;pytesseract">&#x5B89;&#x88C5;pytesseract</h2>
<p>Tesseract &#x662F;&#x4E00;&#x4E2A; Python &#x7684;&#x547D;&#x4EE4;&#x884C;&#x5DE5;&#x5177;&#xFF0C;&#x4E0D;&#x662F;&#x901A;&#x8FC7; import &#x8BED;&#x53E5;&#x5BFC;&#x5165;&#x7684;&#x5E93;&#x3002;&#x5B89;&#x88C5;&#x4E4B;&#x540E;,&#x8981;&#x7528; tesseract &#x547D;&#x4EE4;&#x5728; Python &#x7684;&#x5916;&#x9762;&#x8FD0;&#x884C;&#xFF0C;&#x4F46;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; pip &#x5B89;&#x88C5;&#x652F;&#x6301;Python &#x7248;&#x672C;&#x7684; Tesseract&#x5E93;&#xFF1A;</p>
<p><code>pip install pytesseract</code></p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; BigCat all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x300C;Revision Time:
2017-01-18 03:46:06&#x300D;
</span></footer>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../file/part03/3.5.html" class="navigation navigation-prev " aria-label="Previous page: 案例三：执行JavaScript语句"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../file/part03/3.7.html" class="navigation navigation-next " aria-label="Next page: 处理一些格式规范的文字"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"disqus":{"shortName":"gitbookuse"},"github":{"url":"https://github.com/dododream"},"search-pro":{"cutWordLib":"nodejieba","defineWord":["gitbook-use"]},"sharing":{"weibo":true,"facebook":true,"twitter":true,"google":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"tbfed-pagefooter":{"copyright":"Copyright © BigCat","modify_label":"「Revision Time:","modify_format":"YYYY-MM-DD HH:mm:ss」"},"baidu":{"token":"ff100361cdce95dd4c8fb96b4009f7bc"},"sitemap":{"hostname":"http://www.treenewbee.top"},"donate":{"wechat":"http://weixin.png","alipay":"http://alipay.png","title":"","button":"赏","alipayText":"支付宝打赏","wechatText":"微信打赏"},"edit-link":{"base":"https://github.com/dododream/edit","label":"Edit This Page"},"splitter":{},"toggle-chapters":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
    </body>
    <!-- End of book Python爬虫课程讲义 -->
</html>
